1;

# Gram-Schmidt for rows
function U = gs(V)
	[ r c ] = size(V);
	U = V;
	for k = 1:r
		Vk = V(k,:);
		for j=1:k-1
			Uj = U(j,:);
			a  = sum( Vk .* Uj ) / sum( Uj .* Uj );
      U(k,:) -= a * Uj; 
		end
	end
	for k=1:k
		Uk = U(k,:);
		U(k,:) /= sqrt( sum( Uk .* Uk ) );
	end
endfunction
